﻿using System;

namespace Progream11
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Factorial1(5));
            Console.WriteLine(Factorial2(5));
        }
        //递归算法
        public static long Factorial1(int d)
        {
            if(d==1||d==0)
                return 1;
                else
                    return d * Factorial1(d - 1);
            
        }
        public static long Factorial2(int n)
        {
            var result = 1;
            for (var i = 1; i <= n; i++)
                result = result * i;
            return result;
        }
    }
}
